<?php

use think\facade\Route;

// 商品 路由
Route::group('goods', function () {
    // 商品管理
    Route::get('goods/activitySelect', 'admin.goods.Goods/activitySelect');
    Route::get('goods/select', 'admin.goods.Goods/select');
    Route::get('goods/getType', 'admin.goods.Goods/getType');

    // 规格列表
    Route::get('skuPrice/:goods_id', 'admin.goods.SkuPrice/list');

    // 服务选择
    Route::get('service/select', 'admin.goods.Service/select');

    Route::group(function () {
        // 商品管理
        Route::post('goods/addStock/:id', 'admin.goods.Goods/addStock');
        Route::get('goods/recyclebin', 'admin.goods.Goods/recyclebin');
        Route::put('goods/restore/:id', 'admin.goods.Goods/restore');
        Route::delete('goods/destroy/:id', 'admin.goods.Goods/destroy');
        Route::resource('goods', 'admin.goods.Goods');
        // 商品sku管理
        Route::put('skuPrice/:id', 'admin.goods.SkuPrice/edit');

        // 商品评价
        Route::post('comment', 'admin.goods.Comment/add');
        Route::get('comment/recyclebin', 'admin.goods.Comment/recyclebin');
        Route::put('comment/reply/:id', 'admin.goods.Comment/reply');
        Route::put('comment/restore/:id', 'admin.goods.Comment/restore');
        Route::delete('comment/destroy/:id', 'admin.goods.Comment/destroy');
        Route::resource('comment', 'admin.goods.Comment');

        // 库存预警回收站
        Route::get('stockWarning/recyclebin', 'admin.goods.StockWarning/recyclebin');
        // 补货
        Route::post('stockWarning/addStock/:id', 'admin.goods.StockWarning/addStock');
        Route::resource('stockWarning', 'admin.goods.StockWarning');

        // 补货记录
        Route::resource('stockLog', 'admin.goods.StockLog');

        // 服务保障
        Route::resource('service', 'admin.goods.Service');
    })->middleware('check_rule', 'admin');
});


// 积分商城商品路由
Route::group('app/scoreShop', function () {
    // 选择积分商品
    Route::get('select', 'admin.app.ScoreShop/select');

    Route::group(function () {
        // 积分商城
        Route::put(':goods_id', 'admin.app.ScoreShop/edit');
        Route::delete(':goods_id', 'admin.app.ScoreShop/delete');
        Route::get('recyclebin', 'admin.app.ScoreShop/recyclebin');
        Route::get('skuPrices/:goods_id', 'admin.app.ScoreShop/skuPrices');
        Route::get('skus/:goods_id', 'admin.app.ScoreShop/skus');
        Route::put('restore/:goods_id', 'admin.app.ScoreShop/restore');
        Route::delete('destroy/:goods_id', 'admin.app.ScoreShop/destroy');
        Route::resource('', 'admin.app.ScoreShop');
    })->middleware('check_rule', 'admin');
});